<?php 
	include "../ini.php";
	include "../../libraries/xl_bai_viet.php";
	include "../../libraries/pager.php";
	$dt_pager = new pager;
	$dt_xl_bai_viet	= new xl_bai_viet;
?>


<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">

<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Page-Enter" content="revealTrans(Duration=1.0,Transition=3)">
<?php include"../includes/js_css.php"?>
</head>
<body>
<div id="body-wrapper"> <!-- Wrapper for the radial gradient background -->
  
  <?php include"../widgets/sidebar.php"?>
  <!-- End #sidebar -->
  
  <div id="main-content"> <!-- Main Content Section with everything -->
    
    <?php include"../widgets/noscript.php"?>
    <div class="clear"></div>
    <!-- End .clear -->
    
    <div class="content-box"><!-- Start Content Box -->
      
      <div class="content-box-header">
        <h3>Danh sách bài viết</h3>
        <div class="clear"></div>
      </div>
      <!-- End .content-box-header -->
      
      <div class="content-box-content">
        <div class="tab-content default-tab" id="tab1"> <!-- This is the target div. id must match the href of this div's tab -->
          <div><?php message()?></div>  
          <form name="f2" id="f2" method="post" action="deletes.php">        
          <table>
            <thead>
              <tr>
                <th>Mã</th>
                <th>Tiêu đề</th>
                <th><div style="text-align:center;">Loại bài viết</div></th>
                <th><div style="text-align:center;">Trạng thái</div></th>
                <th><div style="text-align:center;">Ngày đăng</div></th>
                <th style="text-align:center !important;"><input class="check-all" type="checkbox" id="check_all" onclick="chon()">
                <a href="#" onclick="if(confirm('Bạn có chắc muốn xóa sữa hay không')==true)document.f2.submit()"><img src="../images/cross.png" border="0" align="absmiddle" />Xóa</a>
                </th>
              </tr>
            </thead>
            <tfoot>
              <tr>
                <td colspan="6"><div class="bulk-actions align-left">
                    <input class="button" type="submit" value="Xóa" >
                    <input class="button" type="button" value="Thêm" onclick="window.location.href='add.php'" >
                  </div>
                  <div class="pagination"> 
					<?php 
						$tong_so_dong = $dt_xl_bai_viet->so_luong();
						$tong_so_trang = $dt_pager->findPages($tong_so_dong,BAIVIET_LIMIT);
                    	echo $dt_pager->pageList($_GET['page'],$tong_so_trang);
                    ?>
                   </div></td>
              </tr>
            </tfoot>
            <tbody>
            <?php 
				$vitri = $dt_pager->findStart(BAIVIET_LIMIT);
				$ds_bai_viet = $dt_xl_bai_viet->danh_sach($vitri,BAIVIET_LIMIT);
				foreach($ds_bai_viet as $bai_viet){
			?>
              <tr class="alt-row">
                <td><?php echo $bai_viet["ma"]?></td>
                <td><a title="title" href="edit.php?id=<?php echo $bai_viet["ma"]?>"> <?php echo $bai_viet["tieu_de"]?></a></td>
                <td  style="text-align:center"><?php echo $bai_viet["ten"]?></td>
                <td  style="text-align:center"><a href="edit_trang_thai.php?id=<?php echo $bai_viet["ma"]?> "><img src='../images/trangthai_<?php echo $bai_viet['trang_thai']?>.png'> </a></td>
                <td class="ngay_tao" style="text-align:center"><?php echo $bai_viet["ngay_tao"]?></td>
                <td style="text-align:center !important"><a title="Edit" href="edit.php?id=<?php echo $bai_viet["ma"]?> "> <img src="../skins/sa/resources/images/icons/pencil.png" alt="Edit"> </a> <a  title="Delete" href="delete.php?id=<?php echo $bai_viet["ma"]?> " onclick="if(confirm('Bạn có chắc muốn xóa sữa hay không')==true)document.f2.submit()"> <img src="../skins/sa/resources/images/icons/cross.png" alt="Delete"> </a>
                  <input type="checkbox" value="<?php echo $bai_viet["ma"]?>" name="item[]" ></td>
              </tr>
             <?php }?>
            </tbody>
          </table>
          </form>
        </div>
        <!-- End #tab1 --> 
        
      </div>
      <!-- End .content-box-content --> 
      
    </div>
    <!-- End .content-box -->
    
    <div class="clear"></div>
    <?php include"../widgets/footer.php"?>
  </div>
  <!-- End #main-content --> 
  
</div>
</body>
</html>
